#pragma once
#include <stdlib.h>
#include "Point3D.h"
#include "stdafx.h"
#include <GL\glew.h>

struct DrawWindow
{
	DrawWindow * east;
	DrawWindow * west;
	DrawWindow * north;
	DrawWindow * south;
	double * material;
	int sizeOfMaterial;

	Point3D llCorner;
	Point3D ruCorner;
	UINT buffID;

	DrawWindow()
	{
		this->east = this->west = this->north = this->south = NULL;
	}

	void Draw()
	{
	}

	MY_DATATYPE getValueAt(int x,int y)
	{
		MY_DATATYPE result;
		/*glBindBuffer(GL_ARRAY_BUFFER,this->buffID);
		double * buff = (double*)  glMapBuffer(GL_ARRAY_BUFFER,GL_READ_ONLY);
		GLint index = (x+y*width)*3+2;
		result = (MY_DATATYPE)buff[index];
		GLboolean success = glUnmapBuffer(GL_ARRAY_BUFFER);
		glBindBuffer(GL_ARRAY_BUFFER,0);*/
		return result;
	}
	
	bool isPointInside(const Point3D & p)
	{
		if(p.x>ruCorner.x)
			return false;
		if(p.x<llCorner.x)
			return false;
		if(p.y>ruCorner.y)
			return false;
		if(p.y<llCorner.y)
			return false;
		if(p.z<llCorner.z)
			return false;
		if(p.z>ruCorner.z)
			return false;
		return true;
	}
};